package cn.qingyun.gis.modules.init.system.constant.enums;

/**
 * @author wz
 * @version JDK 8
 * @EnumName PointType 
 * @date 2024/11/13
 * @description
 */
public enum PointType {
    MICROGRID(1, "微网格"),
    POLYGON(2, "面数据"),
    POINT(3, "点数据");

    private final int value;
    private final String remark;

    PointType(int value, String remark) {
        this.value = value;
        this.remark = remark;
    }

    public int getValue() {
        return value;
    }

    public String getRemark() {
        return remark;
    }

    public static PointType fromValue(int value) {
        for (PointType pointType : PointType.values()) {
            if (pointType.getValue() == value) {
                return pointType;
            }
        }
        throw new IllegalArgumentException("Invalid value: " + value);
    }

    public static PointType fromRemark(String remark) {
        for (PointType pointType : PointType.values()) {
            if (pointType.getRemark().equals(remark)) {
                return pointType;
            }
        }
        throw new IllegalArgumentException("Invalid remark: " + remark);
    }

    @Override
    public String toString() {
        return "PointType{" +
                "value=" + value +
                ", remark='" + remark + '\'' +
                '}';
    }
}
